//package com.demo.gateway.util;
//
//import com.alibaba.csp.sentinel.slots.block.authority.AuthorityException;
//import com.alibaba.csp.sentinel.slots.block.degrade.DegradeException;
//import com.alibaba.csp.sentinel.slots.block.flow.FlowException;
//import com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowException;
//import com.alibaba.csp.sentinel.slots.system.SystemBlockException;
//
///**
// * @author wuyijie
// * @className: SentinelUtils
// * @description: TODO
// * @date 2021/4/1 18:00
// */
//public class SentinelUtils {
//    public static String HandlerException(Throwable e) {
//        String msg = null;
//        if (e instanceof DegradeException) {
//            msg = "因被降级处理，已被限流";
//        }
//
//        else if (e instanceof FlowException) {
//            msg = "因超过最大流量阈值，已被限流";
//        }
//
//        else if (e instanceof ParamFlowException) {
//            msg = "因超热点流量超过阈值，已被限流";
//        }
//
//        else if (e instanceof SystemBlockException) {
//            msg = "因系统负载过高，已被限流";
//        }
//
//        else if (e instanceof AuthorityException) {
//            msg = "因当前访问来源origin，已在黑白名单或不在白名单，已被限流";
//        }else{
//            msg = "网关异常，请稍后重试";
//        }
//        return msg;
//    }
//}
